function hy_time() {
	
		var _this=$(this);
		var this_=this
		
		if(typeof(_this.attr('data-type')) == 'undefined'||_this.attr('data-type')=='') {
			return;
		}
		
		var type=_this.attr('data-type');
		if (_this.attr('disabled') == 'disabled') {
			return;
		}
		var tel=$('#phone').val();
		if(tel=='')
		{
			 $('#phone_cap_notice').text('请填写完整电话号码');
			 return;
		}
			obj={phone:tel,type:type};
		
			_this.attr('disabled','disabled');
			_this.text('发送中');
			$.post('index.php?act=send_sms', obj, function(result) {
			if (result.error == 0) {
				 $('#phone_cap_notice').text(result.content);
			    time1(this_);
			}
			else
			{
				 $('#phone_cap_notice').text(result.content);
				 _this.removeAttr('disabled');
				 _this.text('获取验证码');
			}

		}, 'json')
//			time1(this_);
			
	}

var wait=60;
function time1(o) {
    if (wait == 0) {
        o.removeAttribute("disabled");
        if (document.getElementById('send-sms')) {
             document.getElementById('send-sms').style.display='';
        };
        if (document.getElementById('captcha_cover')) {
             document.getElementById('captcha_cover').style.display='none'; 
        };
        o.innerHTML="获取验证码";
        wait = 60;
    } else {
        // o.setAttribute('disabled',true);

    	if (document.getElementById('captcha_cover')) {
           document.getElementById('captcha_cover').style.display='';
         };
        if (document.getElementById('send-sms')) {
            document.getElementById('send-sms').style.display='none';
        };
        if (document.getElementById('captcha_cover')) {
             document.getElementById('captcha_cover').innerHTML="发送(" + wait + ")";
        };
        wait--;
        setTimeout(function() {
             time1(o)
         },
         1000);
   }
}

var disabled = 0;
function setPpsn(pp_sn,order_id)
{
	if(disabled){
		return false;
	}
	disabled = 1;
	$.post('flow.php?step=set_pp_sn',{
		order_id:order_id,
		pp_sn:pp_sn
	});
	disbled = 0;
	return true;
}

$(document).ready(function(){
	$('.hy-send-sms').click(hy_time);
});